package cn.imnaer.service.rest.view.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import cn.imnaer.service.persistence.model.Recommend;
import cn.imnaer.service.persistence.model.Scenic;


public class RecommendView implements Serializable {
	public  static  final  String  SCENIC="SCENIC";
	public  static  final  String  SCENIC_GROUP="SCENIC_GROUP";
	public  static  final  String  CITY="CITY";
	private String recommendId;
	private String recommendType;// SCENIC.SCENIC_GROUP.CITY
	private List<String> image=new ArrayList<>();
	private String name;
	private String introduction;// 几个景点直接写在这里面
	private boolean isCollected;
	private String scenicType;// FOOD,PLAY,STAY
	private String avatar;
	private int collectCount; // 收藏就是喜欢，显示喜欢数
	private String type0;
	private String type1;
	private String type2;
	public String getRecommendId() {
		return recommendId;
	}

	public void setRecommendId(String recommendId) {
		this.recommendId = recommendId;
	}

	public String getRecommendType() {
		return recommendType;
	}

	public void setRecommendType(String recommendType) {
		this.recommendType = recommendType;
	}

	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIntroduction() {
		return introduction;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	public boolean getIsCollected() {
		return isCollected;
	}

	public void setIsCollected(boolean isCollected) {
		this.isCollected = isCollected;
	}

	public String getScenicType() {
		return scenicType;
	}

	public void setScenicType(String scenicType) {
		this.scenicType = scenicType;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public int getCollectCount() {
		return collectCount;
	}

	public void setCollectCount(int collectCount) {
		this.collectCount = collectCount;
	}

	public String getType0() {
		return type0;
	}

	public void setType0(String type0) {
		this.type0 = type0;
	}

	public String getType1() {
		return type1;
	}

	public void setType1(String type1) {
		this.type1 = type1;
	}

	public String getType2() {
		return type2;
	}

	public void setType2(String type2) {
		this.type2 = type2;
	}
	public List<String> getImage() {
		return image;
	}

	public void setImage(List<String> image) {
		this.image = image;
	}
	public static RecommendView valueOf(Recommend recommend) {
		RecommendView recommendView = new RecommendView();
		recommendView.setName(recommend.getName());
		List<String> image=new ArrayList<>();
		image.add(recommend.getImage());
		recommendView.setImage(image);
		recommendView.setRecommendId(recommend.getRecommendId());
		recommendView.setRecommendType(recommend.getRecommendType());
		String type = recommendView.getRecommendType();
		switch (type) {
		case "CITY":
			recommendView.setIntroduction("热门目的地");
			break;
		case "SCENIC_GROUP":
			long  size=	recommend.getItemIds().size();
			recommendView.setIntroduction(size+"个景点");
			break;
		default:
			break;
		}		
		return recommendView;
	}
	public static List<RecommendView> valueOfList(List<Recommend> recommendList) {
		List<RecommendView>   recommendViewList=new ArrayList<>();
		for (Recommend recommend : recommendList) {
			RecommendView	recommendView=valueOf(recommend);
			recommendViewList.add(recommendView);
		}
		return recommendViewList;
	}
	public static RecommendView valueOf(Scenic scenic){
		 RecommendView   view=new RecommendView();
		 view.setRecommendId(scenic.getScenicId());
		 view.setName(scenic.getScenicName());
		 view.setImage(scenic.getImages());
		 view.setCollectCount(scenic.getCollectCount());
		 view.setType0("整套房子");
		 view.setRecommendType("SCENIC");
		 view.setScenicType(scenic.getType());
		 view.setType1(scenic.getCommentCount()+"条评论");
		 view.setType2(scenic.getCity().getCityName());
	     return  view;
	}

	public static List<RecommendView> valueOfScenicList(List<Scenic> scenicList) {
		List<RecommendView>  recommendViews=new ArrayList<>();
		
		         for (Scenic scenic : scenicList) {
	
					 recommendViews.add(valueOf(scenic));
				}
		
	
	return recommendViews;
	}
	
}
